package com.lei.springbootpractice.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value="console")
public class ConsolePojo {
    @TableId(value = "console_id", type = IdType.ASSIGN_ID)   // 主键策略
    @TableField(value = "console_id")
    private String consoleId;
    
    @TableField(value = "conversation_id")
    private String conversationId;  // 关联对话会话ID
    
    @TableField(value = "sender_id")
    private String senderId;        // 实际发送者ID（数据库字段）
    
    @TableField(value = "content")
    private String content;         // 消息内容
    
    @TableField(value = "create_time")
    private String createTime;      // 创建时间（数据库字段）
    
    // 非数据库字段，用于显示
    @TableField(exist = false)
    private String senderName;      // 发送者姓名
    
    @TableField(exist = false)
    private String senderRole;      // 发送者角色（customer/customer_service）
    
    @TableField(exist = false)
    private boolean isFromCustomer; // 是否来自顾客

    // 手动添加getter和setter方法确保兼容性
    public String getConsoleId() {
        return consoleId;
    }

    public void setConsoleId(String consoleId) {
        this.consoleId = consoleId;
    }

    public String getConversationId() {
        return conversationId;
    }

    public void setConversationId(String conversationId) {
        this.conversationId = conversationId;
    }

    public String getSenderId() {
        return senderId;
    }

    public void setSenderId(String senderId) {
        this.senderId = senderId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getSenderName() {
        return senderName;
    }

    public void setSenderName(String senderName) {
        this.senderName = senderName;
    }

    public String getSenderRole() {
        return senderRole;
    }

    public void setSenderRole(String senderRole) {
        this.senderRole = senderRole;
    }

    public boolean isFromCustomer() {
        return isFromCustomer;
    }

    public void setFromCustomer(boolean fromCustomer) {
        isFromCustomer = fromCustomer;
    }

    public boolean getIsFromCustomer() {
        return isFromCustomer;
    }

    public void setIsFromCustomer(boolean isFromCustomer) {
        this.isFromCustomer = isFromCustomer;
    }
}